﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace ZoambieGaem {
    class Weapons {

        private static Texture2D pistolTexture;
        private static Texture2D pistolProjectileTexture;
        private static Texture2D sawTexture;
        private static Texture2D sawProjectileTexture;
        private static Texture2D aRifleTexture;
        private static Texture2D aRifleProjectileTexture;
        private static Texture2D shotgunTexture;
        private static Texture2D shotgunProjectileTexture;

        private static float scale = 0;

        private static int pistolRange =            800;
        private static int pistolRangeModifier =    -20;
        private static int pistolDamage =           10;
        private static int pistolDamageModifier =   -1;
        private static double pistolSpeed =         0.25;
        private static double pistolSpeedModifier = -0.1;
        private static int pistolClipSize =         10;
        private static int pistolReloadTime =       60;
        private static int pistolFireRate =         30;

        private static int sawRange =               350;
        private static int sawRangeModifier =       -5;
        private static int sawDamage =              2;
        private static int sawDamageModifier =      0;
        private static double sawSpeed =            0.5f;
        private static double sawSpeedModifier =    0;
        private static int sawClipSize =            1000;
        private static int sawReloadTime =          200;
        private static int sawFireRate =            2;

        private static int aRifleRange =            1600;
        private static int aRifleRangeModifier =    -10;
        private static int aRifleDamage =           8;
        private static int aRifleDamageModifier =   -2;
        private static double aRifleSpeed =         1;
        private static double aRifleSpeedModifier = -0.3;
        private static int aRifleClipSize =         30;
        private static int aRifleReloadTime =       50;
        private static int aRifleFireRate =         10;

        private static int shotgunRange = 1000;
        private static int shotgunRangeModifier = -1000;
        private static int shotgunDamage = 20;
        private static int shotgunDamageModifier = -20;
        private static double shotgunSpeed = 1;
        private static double shotgunSpeedModifier = -0.3;
        private static int shotgunClipSize = 7;
        private static int shotgunReloadTime = 100;
        private static int shotgunFireRate = 30;



        public static void setScale(float scaleA) {
            scale = scaleA;
        }



        public static int getRange(int tyyppi) {
            int range = 0;
            if (tyyppi == 0)
                range = pistolRange;
            else if (tyyppi == 1)
                range = sawRange;
            else if (tyyppi == 2)
                range = aRifleRange;
            else if (tyyppi == 3)
                range = shotgunRange;
            return (int) (range * scale);
        }

        public static double getSpeed(int tyyppi) {
            double speed = 0;
            if (tyyppi == 0)
                speed = pistolSpeed;
            else if (tyyppi == 1)
                speed = sawSpeed;
            else if (tyyppi == 2)
                speed = aRifleSpeed;
            else if (tyyppi == 3)
                speed = shotgunSpeed;
            return speed;
        }

        public static int getDamage(int tyyppi) {
            int damage = 0;
            if (tyyppi == 0)
                damage = pistolDamage;
            else if (tyyppi == 1)
                damage = sawDamage;
            else if (tyyppi == 2)
                damage = aRifleDamage;
            else if (tyyppi == 3)
                damage = shotgunDamage;
            return damage;
        }







        public static int getRangeModifier(int tyyppi) {
            int modifier = 0;
            if (tyyppi == 0)
                modifier = pistolRangeModifier;
            else if (tyyppi == 1)
                modifier = sawRangeModifier;
            else if (tyyppi == 2)
                modifier = aRifleRangeModifier;
            else if (tyyppi == 3)
                modifier = shotgunRangeModifier;
            return (int) (modifier * scale);
        }

        public static double getSpeedModifier(int tyyppi) {
            double modifier = 0;
            if (tyyppi == 0)
                modifier = pistolSpeedModifier;
            else if (tyyppi == 1)
                modifier = sawSpeedModifier;
            else if (tyyppi == 2)
                modifier = aRifleSpeedModifier;
            else if (tyyppi == 3)
                modifier = shotgunSpeedModifier;
            return modifier;
        }

        public static int getDamageModifier(int tyyppi) {
            int modifier = 0;
            if (tyyppi == 0)
                modifier = pistolDamageModifier;
            else if (tyyppi == 1)
                modifier = sawDamageModifier;
            else if (tyyppi == 2)
                modifier = aRifleDamageModifier;
            else if (tyyppi == 3)
                modifier = shotgunDamageModifier;
            return modifier;
        }





        public static int getClipSize(int tyyppi) {
            int clipSize = 0;
            if (tyyppi == 0)
                clipSize = pistolClipSize;
            else if (tyyppi == 1)
                clipSize = sawClipSize;
            else if (tyyppi == 2)
                clipSize = aRifleClipSize;
            else if (tyyppi == 3)
                clipSize = shotgunClipSize;
            return clipSize;
        }

        public static int getReloadTime(int tyyppi) {
            int reloadTime = 0;
            if (tyyppi == 0)
                reloadTime = pistolReloadTime;
            else if (tyyppi == 1)
                reloadTime = sawReloadTime;
            else if (tyyppi == 2)
                reloadTime = aRifleReloadTime;
            else if (tyyppi == 3)
                reloadTime = shotgunReloadTime;
            return reloadTime;
        }

        public static int getFireRate(int tyyppi) {
            int fireRate = 0;
            if (tyyppi == 0)
                fireRate = pistolFireRate;
            else if (tyyppi == 1)
                fireRate = sawFireRate;
            else if (tyyppi == 2)
                fireRate = aRifleFireRate;
            else if (tyyppi == 3)
                fireRate = shotgunFireRate;
            return fireRate;
        }


        public static Texture2D getProjectileTexture(int tyyppi) {
            Texture2D tex = null;
            if (tyyppi == 0)
                tex = pistolProjectileTexture;
            else if (tyyppi == 1)
                tex = sawProjectileTexture;
            else if (tyyppi == 2)
                tex = aRifleProjectileTexture;
            else if (tyyppi == 3)
                tex = shotgunProjectileTexture;
            return tex;
        }

        public static Texture2D getTexture(int tyyppi) {
            Texture2D tex = null;
            if (tyyppi == 0)
                tex = pistolTexture;
            else if (tyyppi == 1)
                tex = sawTexture;
            else if (tyyppi == 2)
                tex = aRifleTexture;
            else if (tyyppi == 3)
                tex = shotgunTexture;
            return tex;
        }

        public static void setTextures(Texture2D pistol, Texture2D pistolP, Texture2D saw, Texture2D sawP, Texture2D rif, Texture2D rifP, Texture2D shotgun, Texture2D shotgunP) {
            pistolTexture = pistol;
            pistolProjectileTexture = pistolP;
            sawTexture = saw;
            sawProjectileTexture = sawP;
            aRifleTexture = rif;
            aRifleProjectileTexture = rifP;
            shotgunTexture = shotgun;
            shotgunProjectileTexture = shotgunP;
        }
    }
}